import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

// 路由表
const routes = [
  {
    path: '/login',
    // 设置路由名称，命名路由
    name: 'login',
    // 路由懒加载
    component: () => import('@/views/login'),
  },
  {
    path: '/',
    name: 'layout',
    component: () => import('@/views/layout'),
    redirect: '/login',
    children: [
      {
        path: 'home', //默认子路由
        name: 'home',
        component: () => import('@/views/home'),
      },
      {
        path: 'company',
        name: 'company',
        component: () => import('@/views/company'),
      },
      {
        path: 'staff',
        name: 'staff',
        component: () => import('@/views/staff'),
      },
      {
        path: 'my',
        name: 'my',
        component: () => import('@/views/my'),
      },
      {
        path:'facesheet',
        name:'facesheet',
        component:()=> import('@/views/my/components/facesheet.vue')
      }
    ]
  },
  // 入驻商务部页面
  {
    path: '/settled',
    name: 'settled',
    component:()=>import('@/views/home/settled.vue')
  },
  // 家政服务页面
  {
    path: '/service',
    name: 'service',
    component: ()=>import('@/views/home/service.vue')
  },
  // 家政服务标准
  {
    path: '/standard',
    name: 'standard',
    component: ()=>import('@/views/home/standard.vue')
  },
  {
    path: '/frim/:id',
    name: 'CompanyDetails',
    component: () => import('@/views/company-etails'),
    props: true,
  },
  {
    path: '/staff/:id',
    name: 'staffDetail',
    component: () => import('@/views/staff-detail'),
    props: true,
  },
  {
    path: '/myAttention',
    // 我的关注页面
    name: 'myAttention',
    component: () => import('@/views/my/myAttention')
  },
  {
    path: '/myContacted',
    // 我的已联系页面
    name: 'myContacted',
    component: () => import('@/views/my/myContacted')
  }

]

const router = new VueRouter({
  routes,
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }
  }
})

export default router
